#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
void rotate(int* nums, int numsSize, int k) {
    k %= numsSize;
    int i = 0;
    int j = 0;
    int sum = 0;
    for (i = 0; i < k; i++)
    {
        for (j = numsSize - k + i; j > i; j--)
        {
            sum = *(nums + j);
            *(nums + j) = *(nums + j - 1);
            *(nums + j - 1) = sum;
        }
    }

}
int main()
{
    int i = 0;
    int num[8] = { 1,2,3,4,5,6,7,8 };
    rotate(num, sizeof(num) / sizeof(0), 3);
    for (i = 0; i < 8; i++)
    {
        printf("%d ", num[i]);
    }
	return 0;
}